package com.wuxiaofan.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.config.Idgenerator;
import com.wuxiaofan.entity.UserLoginRecord;
import com.wuxiaofan.entity.custom.UserLoginRecordCustom;
import com.wuxiaofan.mapper.UserLoginRecordMapper;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserLoginRecordService {
    @Autowired
    private UserLoginRecordMapper userLoginRecordMapper;
    @Resource
    private Idgenerator idgenerator;
    public UserLoginRecord findById(String id){
        return userLoginRecordMapper.selectById(id);
    }

    public UserLoginRecordCustom findCountByMap(Map paraMap){
        return userLoginRecordMapper.findCountByMap(paraMap);
    }

    public UserLoginRecordCustom findGroupByMap(Map paraMap){
        return userLoginRecordMapper.findGroupByMap(paraMap);
    }

    public List<UserLoginRecordCustom> findByMap(Map paraMap){
        return userLoginRecordMapper.findByMap(paraMap);
    }

    public Page<UserLoginRecordCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(userLoginRecordMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        userLoginRecordMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        userLoginRecordMapper.deleteById(id);
    }

    public UserLoginRecord save(UserLoginRecord userLoginRecord){
        userLoginRecord.setId(idgenerator.getId());
        userLoginRecordMapper.insert(userLoginRecord);
        return userLoginRecord;
    }

}
